<?php
    class Street_Model extends dl_connect{
        
        function __construct(){
            $this->Connect();
        }
        
        /**
         * insert a record to street table
         * @return INT
         * */
        public function add($name){
            $this->ExecuteSQL("INSERT INTO `dulich`.`street` (`St_Id` , `TenDuong` )
                                    VALUES (NULL , '{$name}' )");
            if(mysql_affected_rows($this->con)>0){
                return 1;
            }else{
                return 0;
            }
        }
        
        /**
         * edit a record from street table
         * @return INT
         * */
        public function edit($name,$id){
            $this->ExecuteSQL("UPDATE `dulich`.`street` SET `TenDuong` = '{$name}' WHERE `street`.`St_Id` = {$id}");
            if(mysql_affected_rows($this->con)>0){
                return 1;
            }else{
                return 0;
            }
        }
        
        /**
         * delete a record from street table
         * @return INT
         * */
        public function delete($id){
            $this->ExecuteSQL("DELETE FROM `dulich`.`street` WHERE `street`.`St_Id` = {$id}");
            if(mysql_affected_rows($this->con)>0){
                return 1;
            }else{
                return 0;
            }
        }
         
    }
?>